import RPi.GPIO as GPIO

# 初始化编码
GPIO.setmode(GPIO.BCM)

#人体红外感应
class BodyInduction:


    def __init__(self, pin_body, pin_led):
        print("body:{}, led:{}", pin_body, pin_led)
        # 初始化led
        GPIO.setup(pin_led, GPIO.OUT)
        # 初始化红外感应人体
        GPIO.setup(pin_body, GPIO.IN)



    def inductionHumanBody(self, pin_body, pin_led):
        print("body1:{}, led1:{}", pin_body, pin_led)

        # 点亮led
        GPIO.output(pin_led, GPIO.HIGH)
        GPIO.cleanup()
        return GPIO.input(pin_body)


